package ngames.com.sushitv.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * Created by Administrator on 2016/1/20.
 */
public class TabFragmentPagerAdapter extends FragmentPagerAdapter {
    private Fragment[] mFragments;
    private String[] mTabNames;

    public TabFragmentPagerAdapter(FragmentManager fm, String[] tabNames) {
        super(fm);
        this.mTabNames = tabNames;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments[position];
    }

    @Override
    public int getCount() {
        return mTabNames.length;
    }

    /**
     *显示tab名称
     */
    @Override
    public CharSequence getPageTitle(int position) {
        return mTabNames[position];
    }

    public void setFragments(Fragment[] list) {
        mFragments = list;
    }
}